<script>
  export default {
    onLaunch: function() {
      console.warn(
        '当前组件仅支持 uni_modules 目录结构 ，请升级 HBuilderX 到 3.1.0 版本以上！'
      )
      console.log('App Launch')
      // 获取胶囊位置
      // #ifdef MP-WEIXIN
      uni.setStorageSync('menuButtonInfo', uni.getMenuButtonBoundingClientRect())

      wx.login({
        success: (res) => {
          if (res.code) {
            console.log(res.code)
          } else {
            console.log('登录失败！' + res.errMsg)
          }
        }
      })
      // #endif
    },
    onShow: function() {
      console.log('App Show')
      this.$api.getCarCount().then((res) => {
        console.log(res)
        if (res.code === 0) {
          this.$store.commit('setCartCount', res.data.count)
        }
      })
    },
    onHide: function() {
      console.log('App Hide')
    },
  }
</script>

<style lang="scss">
  /*每个页面公共css */
  @import '@/uni_modules/uni-scss/index.scss';
  @import '@/common/css/index.scss';

  /* 解决小程序和app滚动条的问题 */
  /* #ifdef MP-WEIXIN */
  ::-webkit-scrollbar {
    display: none;
    width: 0 !important;
    height: 0 !important;
    -webkit-appearance: none;
    background: transparent;
    color: transparent;
  }

  /* #endif */
</style>